<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Path functions vGIN for Alladyn</title>
<meta name="Author" content="Gandalf">
<script language="JavaScript" src="Alladyn.js"></script>
<script language="JavaScript">
<!--
// Path Plugin
function AT_path(v){
var M=Math,R=M.PI/180;
	function r(c,p,k,d,t,s){
		for(i=R*p;i<R*(p+k);i+=R*k/t)v.van.KF({left:d*M.cos(i)+c[0],top:(d+=s?s:0)*M.sin(i)+c[1]},1)
	}
	function f(c,m,s,a,b,t,p){
		for(i=m[0];i<=m[1];i+=(m[1]-m[0])/t)v.van.KF({left:i*s+c[0],top:-a*M.pow(i,p?p:1)*s-b*s+c[1]},1)
	}
return {round:r,func:f}
}
// End of Path Plugin
var rou,fnc;
function init(){
Alladyn(['AT_path']);
with(vlay.x){vGIN.AT_path['round']([550,650],270,360,50,20);van.mode="loop";van.go=1;}
with(vlay.xy){vGIN.AT_path['func']([600,200],[-3,8],20,0.3,0,100,3);van.mode="ping";van.go=1;}
with(rou=Al.A()){push(vlay.x);go(40)}
with(fnc=Al.A()){push(vlay.xy);go(40)}
}

function act(){
D=document.form1.elements;
with(vlay.xy){van.purge();vGIN.AT_path['func']([600,200],[-2,8],20,-0.1,0,20,2);van.mode=D['vm'].value;van.go=1;}
fnc.go(40);
}
//[600,200],[parseInt(D['x3'].value),D['x2'].value],20,D['pa'].value,D['pb'].value,D['pt'].value,D['px'].value

function act2(){
D=document.form2.elements;
status=parseFloat(D['as'].value);
with(vlay.x){van.reset();vGIN.AT_path['round']([550,650],parseInt(D['ab'].value),parseInt(D['ar'].value),parseInt(D['ap'].value),parseInt(D['at'].value),parseFloat(D['as'].value));van.mode=D['avm'].value;van.go=1;van.group='r'}
rou.push(vlay.x);
rou.go(40);
}
//-->
</script>
</head>

<body onload="init()" bgcolor="#FFFFFF">
<div id="Layer1" style="position:absolute; left:400; top:0; width:400; height:400; z-index:1"><img src="ruler.gif" width="400" height="400"></div>
<div id="xy" style="position:absolute; left:0; top:0; width:1; height:1; z-index:7"><img src="1.gif" width="10" height="10"></div>
<div id="x" style="position:absolute; left:0; top:0; width:10; height:10; z-index:7"><img src="1.gif" width="10" height="10"></div>

<div id="Layer2" style="position:absolute; left:350; top:450; width:400; height:400; z-index:3"><img src="ruler.gif" width="400" height="400"></div>
<form name="form1" method="post" action="">
  <table width="344" border="1" cellspacing="0" cellpadding="0">
    <tr> 
      <td colspan="2">vGIN function path (;p) wedle y=a*x+b</td>
    </tr>
    <tr> 
      <td>a</td>
      <td> 
        <input type="text" name="pa" value="0.3" onchange="act()">
      </td>
    </tr>
    <tr> 
      <td>b</td>
      <td> 
        <input type="text" name="pb" value="0" onchange="act()">
      </td>
    </tr>
    <tr> 
      <td height="21">potega dla x</td>
      <td height="21"> 
        <input type="text" name="px" value="3" onchange="act()">
      </td>
    </tr>
    <tr> 
      <td height="21">od x=</td>
      <td height="21"> 
        <input type="text" name="x3" value="-3" onchange="act()">
      </td>
    </tr>
    <tr> 
      <td height="21">do x=</td>
      <td height="21"> 
        <input type="text" name="x2" value="8" onchange="act()">
      </td>
    </tr>
    <tr> 
      <td height="21">ilosc taktow na wykonanie sciezki:</td>
      <td height="21"> 
        <input type="text" name="pt" value="100" onchange="act()">
      </td>
    </tr>
    <tr> 
      <td height="21">van.mode=</td>
      <td height="21"> 
        <select name="vm" onchange="act()">
          <option value="">normal</option>
          <option value="ping" selected>ping</option>
          <option value="loop">loop</option>
        </select>
      </td>
    </tr>
    <tr> 
      <td height="21" colspan="2">Nieaktywne parametry:</td>
    </tr>
    <tr> 
      <td height="21">pozycja punktu (0,0)</td>
      <td height="21">[600,200]</td>
    </tr>
    <tr> 
      <td height="21">w pikselach wielkosc jednostki</td>
      <td height="21">20</td>
    </tr>
  </table>
  <a href="#" onclick="act()">Refresh</a> 
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<a name="rnd"></a>
<form name="form2" method="post" action="">
  <table width="300" border="1" cellspacing="0" cellpadding="0">
    <tr> 
      <td colspan="2">vGIN round path</td>
    </tr>
    <tr> 
      <td>kat rozpoczecia:</td>
      <td> 
        <input type="text" name="ab" onchange="act2()" value="270">
      </td>
    </tr>
    <tr> 
      <td>kat obrotu:</td>
      <td> 
        <input type="text" name="ar" onchange="act2()" value="360">
      </td>
    </tr>
    <tr> 
      <td>promien:</td>
      <td> 
        <input type="text" name="ap" onchange="act2()" value="50">
      </td>
    </tr>
    <tr> 
      <td>czas na wykonanie:</td>
      <td> 
        <input type="text" name="at" onchange="act2()" value="10">
      </td>
    </tr>
    <tr> 
      <td>promien zgiecia (if spirala ;p)</td>
      <td> 
        <input type="text" name="as" onchange="act2()" value="0">
      </td>
    </tr>
    <tr> 
      <td>van.mode=</td>
      <td>
        <select name="avm" onchange="act2()" onChange="act()">
          <option value="">normal</option>
          <option value="ping">ping</option>
          <option value="loop" selected>loop</option>
        </select>
      </td>
    </tr>
    <tr> 
      <td colspan="2">Nieaktywne parametry:</td>
    </tr>
    <tr> 
      <td>srodek:</td>
      <td>[100,100]</td>
    </tr>
  </table>
    <a href="#rnd" onclick="act2()">Refresh</a> 
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
